<%@page import="com.shsh.safemanage.util.RequestUtil"%>
<%@page import="com.shsh.safemanage.util.Util"%>
<%@page import="com.shsh.safemanage.model.Department1"%>
<%@page import="com.shsh.safemanage.model.WeakCorpReport"%>
<%@page import="com.shsh.safemanage.action.ActionCreator"%>
<%@page import="com.shsh.safemanage.action.WeakAction"%>
<%@page import="com.shsh.safemanage.util.Constants"%>
<%@page language="java" pageEncoding="UTF-8"%>
<%
{
	session.removeAttribute(Constants.SESSION_WEAK_CORP_REPORT);
	
	Integer year = RequestUtil.getParameter(request, Constants.REQUEST_PARAMETER_YEAR, (Integer)null);
	
	WeakAction weakAction =ActionCreator.createWeakAction();
	boolean isSuccess = weakAction.generateWeakCorpReport(request);
	if(!isSuccess) {
		return;
	}
	
	WeakCorpReport corpReport = (WeakCorpReport)session.getAttribute(Constants.SESSION_WEAK_CORP_REPORT);
%>
<div class="hider" id="hider">
	<span>&nbsp;</span>
</div>
<div class="position">
	<img src="images/position2.jpg" style="padding: 7px 9px; float: left;" />当前位置：上海高桥分公司问题管理平台 &gt;&gt; 十大薄弱环节汇总 &gt;&gt;浏览
</div>
<div class="tt"></div>
<div class="content" style="">
	<div style="margin-left: 10px">
	<span id="monthSelectSpan" style="margin-left: 10px;float:left;">	
	<%@include file="/weak/year_select_section.jsp" %>
	</span>
	</div>
<table border="1" width="99%" style="align:center; margin-left: 6px">
	<tr>
		<td style="text-align:center;width:18%;" class="td3">
		单位/月份
		</td>
<%
for(int i=0;i<12;i++) {
%>
		<td style="text-align:center;width:6%;" class="td3">
			<%=i+1 %>
		</td>
<%
}
%>
	</tr>
<%
for (Department1 shiyebu: corpReport.getShiyebuList().values()) {
%>
	<tr style="height:20px;">
		<td style="text-align:center;" class="td3">
			<%=Util.getDisplay(shiyebu.getDepartmentName(), "&nbsp;") %>
		</td>
<%
	Boolean[] tableArray = corpReport.getTable().get(shiyebu.getId());
	for(int i=0;i<12;i++) {
		boolean written = tableArray[i]!=null&&tableArray[i];
		if(!written) {
%>
		<td style="text-align:center;">
			未报
		</td>
<%
		} else {
%>
		<td style="text-align:center;">
			<a href="javascript:" onclick="openDanweiWeakReport(<%=shiyebu.getId()%>, <%=i+1%>)">明细</a>
		</td>
<%
		}
	}
%>
	</tr>
<%
}
%>

<%
for (Department1 chushi: corpReport.getChushiList().values()) {
%>
	<tr style="height:20px;">
		<td style="text-align:center;" class="td3">
			<%=Util.getDisplay(chushi.getDepartmentName(), "&nbsp;") %>
		</td>
<%
	Boolean[] tableArray = corpReport.getTable().get(chushi.getId());
	for(int i=0;i<12;i++) {
		boolean written = tableArray[i]!=null&&tableArray[i];
		if(!written) {
%>
		<td style="text-align:center;">
			未报
		</td>
<%
		} else {
%>
		<td style="text-align:center;">
			<a href="javascript:" onclick="openDanweiWeakReport(<%=chushi.getId()%>, <%=i+1%>)">明细</a>
		</td>
<%
		}
	}
%>
	</tr>
<%
}
%>
</table>
</div>
<script type="text/javascript">
function openDanweiWeakReport(depart1ID, month){
	openWaitingDialog('waitingDialog');
	loadPageSection('<%=request.getContextPath()%>/weak/read_danwei_report.jsp', 'mainContentDiv', 
			{
				depart1ID : depart1ID,
				year: <%=year%>,
				month: month
			},
			true
		);
}

function changeReport(){
	var year = getElementValueByID('year');
	loadPageSection(
			'<%=request.getContextPath()%>/weak/read_corp_report.jsp', 
			'mainContentDiv', 
			{
				year: year 
			}, 
			true
	);
}
function selectYear(){
	changeReport();
}
</script>
<%
}
%>